
package org.sevenblindmice.make24;

import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.widget.ListView;

class MyListView extends ListView {
    public MyListView(Context context) {
        super(context);
    }

    public MyListView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected boolean onRequestFocusInDescendants(int direction,
            Rect previouslyFocusedRect) {
        return false; // required for Nexus7 when row has EditText
    }

    public boolean scrollToPosition(int position) {
        int firstPos = getFirstVisiblePosition();
        int lastPos = getLastVisiblePosition();
        if (position < firstPos || position > lastPos) {
            setSelection(position);
            return true;
        }
        return false;
    }
}
